#include <stdio.h>
#include <string.h>
#define maxn 20
int a[maxn][maxn];
int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    scanf("%d", &n);
    int  x = 0, y = n - 1, tot = 1,i,j;
    memset(a, 0, sizeof(a));
    a[x][y] = 1;
    while (tot < n * n)
    {
        while (x + 1 < n && a[x + 1][y] == 0)
            a[++x][y] = ++tot;

        while (y - 1 >= 0 && a[x][y - 1] == 0)
            a[x][--y] = ++tot;

        while (x - 1 >= 0 && a[x - 1][y] == 0)
            a[--x][y] = ++tot;

        while (y + 1 < n && a[x][y + 1] == 0)
            a[x][++y] = ++tot;
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
            printf("%3d ", a[i][j]);
        printf("\n");
    }
    return 0;
}